//
//  HRSureOrderTableViewCell.m
//  haierapp
//
//  Created by Xia Zhiyong on 14-8-14.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import "HRSureOrderTableViewCell.h"
#import "HRProductInfo.h"
#import "HRGoodsInfo.h"

@implementation HRSureOrderTableViewCell

- (void)awakeFromNib
{

}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = (HRSureOrderTableViewCell *)[[[NSBundle mainBundle] loadNibNamed:@"HRSureOrderTableViewCell"
                                                                         owner:self
                                                                    options:nil] objectAtIndex:0];
    
    return self;

}

-(void)configWithData:(id)data{
    
    HRProductInfo *info=(HRProductInfo *)data;
    
    [_imgIcon setImageWithURL:[NSURL URLWithString:info.picMinPath]
             placeholderImage:[UIImage imageNamed:IMAGENAME_PLACE_HODLE]];
    _lblName.text = [NSString stringWithFormat:@"%@",info.name];
    _lblDetail.text = @"";
    
    NSString *param=@"";
    for (HRProSpeInfo *paramInfo in info.proSpeInfo) {
        param=[NSString stringWithFormat:@"%@:%@;%@",paramInfo.name,paramInfo.value,param];
        _lblDetail.text=param;
        if (info.proSpeInfo.count>1) {
            HRProSpeInfo *speInfo2 = [info.proSpeInfo objectAtIndex:1];
            _lblType.text = [NSString stringWithFormat:@"%@:%@", speInfo2.name,speInfo2.value];
        }
    }
    
    
    
    _lblNum.text = [NSString stringWithFormat:@"x%d",[info.goodsAmount intValue]];
    _lblPrice.text = [NSString stringWithFormat:@"￥%@",info.price];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
